<?php
namespace app\index\controller;
header("Access-Control-Allow-Origin: *");


use app\common\controller\HomeBase;
use think\Db;

class Index extends HomeBase
{
    protected function _initialize(){
        parent::_initialize();
    }

    public function index()
    {
        $banner_list = Db('slide')->where('cid',1)->select();
        dump($banner_list);
        if($banner_list){
            $this->apiSuccess($banner_list);
        }else{
            $this->apiError('没有查到信息');
        }
    }

    /**
    *轮播图
    *@param int $id 轮播图的id
    **/
    public function showPhoto($id=1)
    {
        $showPhoto_list = Db('slide')->where('cid',$id)->select();
        if($showPhoto_list){
            $this->apiSuccess($showPhoto_list);
        }else{
            $this->apiError('没有查到信息');
        }
    }

    public function upload()
    {
        $files = $this->request->file('file');
        dump($files);
    }
}
